import 'package:tile/tile.dart';

import '../data/terms_coordinates.dart';
import '../direction.dart';

bool isOneLine(TermsCoordinates termsCoordinates) {
  return termsCoordinates.line == '一线';
}

bool isTwoLine(TermsCoordinates termsCoordinates) {
  return termsCoordinates.line == '二线';
}

bool isThreeLine(TermsCoordinates termsCoordinates) {
  return termsCoordinates.line == '三线';
}

bool isFourLine(TermsCoordinates termsCoordinates) {
  return termsCoordinates.line == '四线';
}

bool isOneOne(TermsCoordinates termsCoordinates) {
  return termsCoordinates.direction == '一一';
}

bool isTwoTwo(TermsCoordinates termsCoordinates) {
  return termsCoordinates.direction == '二二';
}

bool isThreeThree(TermsCoordinates termsCoordinates) {
  return termsCoordinates.direction == '三三';
}

bool isStar(TermsCoordinates termsCoordinates) {
  return termsCoordinates.direction == '星位';
}

bool isUnderFourQuadrant(TermsCoordinates? termsCoordinates) {
  if (termsCoordinates!.line == null) return false;
  String line = termsCoordinates.line!;
  return line == '一线' || line == '二线' || line == '三线';
}

bool isThreeLineFromStep(ChessStep chessStep) {
  // printInfo('转换后的棋谱：${chessStep.toGtp()}');
  var descCoordinates = calculateDirection(chessStep.toGtp());
  return descCoordinates!.line == '三线';
}

bool isFourLineFromStep(ChessStep chessStep) {
  var descCoordinates = calculateDirection(chessStep.toGtp());
  return descCoordinates!.line == '四线';
}

bool isThreeOrFourLine(ChessStep chessStep) {
  var descCoordinates = calculateDirection(chessStep.toGtp());
  return descCoordinates!.line == '三线' || descCoordinates.line == '四线';
}

bool isOneOrTwoLine(ChessStep chessStep) {
  var descCoordinates = calculateDirection(chessStep.toGtp());
  return descCoordinates!.line == '一线' || descCoordinates.line == '二线';
}

bool isOneLineFromStep(ChessStep chessStep) {
  var descCoordinates = calculateDirection(chessStep.toGtp());
  return descCoordinates!.line == '一线';
}

bool isTwoLineFromStep(ChessStep chessStep) {
  var descCoordinates = calculateDirection(chessStep.toGtp());
  return descCoordinates!.line == '二线';
}
